Support for a parameterized query/view in complex event processing

ABSTRACT

The present invention includes a method for providing parameterized queries in complex event processing (CEP). The method includes providing a query template which includes one or more bind variables, providing sets of parameters corresponding to the one or more bind variables, and parsing the query template to determine positions of the one or more bind variables. The method further includes scanning the provided sets of parameters to determine which of the sets of parameters are to be bound to the one or more bind variables, binding the one or more bind variables which are determined to be bound to the sets of parameters, and substituting the bound one or more bind variables with the corresponding sets of parameters. The method further includes injecting all incarnations of the parameterized queries into the system, and one template/parameterized query is configured to run them all.

CROSS-REFERENCES

This application claims priority from co-pending U.S. Provisional Patent Application No. 61/384,182, filed Sep. 17, 2010, entitled “SUPPORT FOR PARAMETERIZED QUERY/VIEW IN COMPLEX EVENT PROCESSING,” which is hereby incorporated by reference, as if set forth in full in this document, for all purposes.

BACKGROUND

Embodiments of the present invention relate to data processing systems and more particularly to systems and applications pertaining to streaming data with temporal semantics.

Generally, Complex Event Processing (CEP) is an approach that aggregates information from distributed message-based systems, databases, and applications in real-time and dynamically applies rules to discern patterns and trends that would otherwise go unnoticed. This gives companies the ability to identify and even anticipate exceptions and opportunities represented by seemingly unrelated events across highly complex, distributed, and heterogeneous IT environments. CEP may be used to correlate, aggregate, enrich, and detect patterns in high speed streaming data in near real time.

Furthermore, Continuous Query Language (CQL) statements are used to process event streams comprising events. An event stream can be considered a sequence of <tuple, timestamp> pairs, with the tuple referring to the data portion. A stream can have multiple tuples and timestamps can define an order over the tuples in an event stream. Oracle™ Complex Event Processing (OCEP) is used to process such event streams.

Further, a CEP application can have multiple queries and views, which are then executed by a processor. Any real-world application may consist of hundreds of queries and views that only differ in a certain value like range parameter. Maintaining hundreds of queries and views in such a scenario can become a nightmare because a small change in base query or view will lead to affecting hundreds of dependent queries and views.

Use of a form of parameterization or wildcard placeholders provision helps application developers in writing similar queries and views, which differ only by a small criterion. In one embodiment, users are allowed to put wildcard placeholders, which can then be bound with values at runtime. Parameterized Query or view can be viewed as a template, which can then be used for different values. This provides users with the ability to write a single CQL statement that internally can generate multiple CQL statements for different values provided in the bindings.

For Example:

SELECT symbol, AVG(price) AS average, NASDAQ AS market

-   -   FROM StockTick t RETAIN ALL EVENTS     -   WHERE symbol=ORCL     -   SELECT symbol, AVG(price) AS average, NYSE AS market     -   FROM StockTick t RETAIN ALL EVENTS     -   WHERE symbol=JPM     -   SELECT symbol, AVG(price) AS average, NYSE AS market     -   FROM StockTick t RETAIN ALL EVENTS     -   WHERE symbol=WFC

It should be noted that the above queries differ either in constant value in project list or constant value in WHERE condition. If there are hundreds of such queries, then any business user might have to write hundreds of such queries and views. Hence, for these and other reasons, improvements in the art are needed.

BRIEF SUMMARY

Embodiments of the present invention include using CEP string substitution to replace the bind variables with the sets of parameters provided for the bind variables, without doing any kind of type checking, etc. This is different from regular databases, in that bind variables also have to pass through type checking, etc. As a result, bind variables in the CEP context offer a more flexible and as a result a more powerful solution, which allows the user to insert arbitrary predicates. Accordingly, bind variables in the CEP environment may be typeless.

The present invention includes a method of providing parameterized queries in complex event processing (CEP). The method includes providing a query template which includes one or more bind variables, providing sets of parameters corresponding to the one or more bind variables, and parsing the query template to determine positions of the one or more bind variables. The method further includes scanning the provided sets of parameters to determine which of the sets of parameters are to be bound to the one or more bind variables, binding the one or more bind variables which are determined to be bound to the sets of parameters, and substituting the bound one or more bind variables with the corresponding sets of parameters.

The method further includes building a map of the determined positions of the one or more bind variables. The substituting of the one or more bind variables with the corresponding sets of parameters includes using the map of determined positions of the one or more bind variables to place the bound sets of parameters within the query template. The providing of the sets of parameters corresponding to the one or more bind variables is performed either statically or dynamically.

In a further embodiment, the providing of the sets of parameters corresponding to the one or more bind variables is performed statically by using a config file at deployment time of the query template, and the providing of the sets of parameters corresponding to the one or more bind variables is performed dynamically by using a module management solution. The config file includes one or more of the following: application association, processor association, query rules, the query template, the sets of parameters, or the bindings.

The method further includes instantiating a new query based on the query template which includes the sets of parameters substituted for the one or more bind variables, instantiating the new query, and injecting the new query into a CEP server. Further, the method includes based on the new query, building a query execution plan, adding the query execution plan to a runtime environment as a continuous query, and executing the continuous query.

The method further includes determining that multiple sets of parameters correspond to the same bind variable, and instantiating a separate new query for each of the multiple sets of parameters which correspond to the same bind variable.

In another embodiment a system for providing parameterized queries in complex event processing (CEP), is described. The system includes a memory and a processor coupled with the memory. The memory has sets of instructions stored thereon which, when executed by the processor, cause the processor to determine a placeholder occurring in a parameterized query for processing an event stream, determine a parameter for the placeholder, generate a query from the parameterized query by substituting the placeholder with the parameter, generate the query; and process the event stream.

The system further includes a CEP server which includes a CQL engine. The CQL engine instantiates CEP applications. The system also includes a visualizer in communication with the CEP server. The visualizer is configured to display result information from the processed event stream.

In a further embodiment. a computer-readable medium is described. The computer-readable medium includes instructions for providing a query template which includes one or more bind variables, providing sets of parameters corresponding to the one or more bind variables, and parsing the query template to determine positions of the one or more bind variables. The computer-readable medium further includes instructions for scanning the provided sets of parameters to determine which of the sets of parameters are to be bound to the one or more bind variables, binding the one or more bind variables which are determined to be bound to the sets of parameters, and substituting the bound one or more bind variables with the corresponding sets of parameters.

The computer-readable medium further includes instructions for determining that new sets of parameters are specified for binding, identifying queries which have been instantiated using sets of parameters prior to being specified with new sets of parameters, deleting the queries which have been instantiated using sets of parameters prior to being specified with new sets of parameters, and instantiating queries using the new sets of parameters for the runtime system.

The computer-readable medium further includes instructions for converting the sets of parameters into strings, checking the strings of the sets of parameters to determine a form of the sets of parameters, comparing the determined type of the sets of parameters with the type of the corresponding bind variables, and in response to the determined type of the sets of parameters matching the type of the corresponding bind variables, verifying the sets of parameters. The type of the corresponding bind variables and sets of parameters may include one or more of the following: INT, FLOAT, LONG, BIGDECIMAL, DOUBLE, and STRING.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is block diagram of an event processing server, according to an embodiment of the present invention.

FIGS. 2A-2C are flow diagrams for implementing parameterized queries in CEP, according to embodiments of the present invention.

FIG. 3 is a flow diagram for implementing parameterized queries in CEP, according to an embodiment of the present invention.

FIGS. 4A-4D are block diagrams of parameterized queries in CEP, according to embodiments of the present invention.

FIGS. 5A and 5B are block diagrams for implementing parameterized queries in CEP, according to an embodiment of the present invention.

FIG. 6 is a user interface for implementing parameterized queries in CEP, according to an embodiment of the present invention.

FIG. 7 is a simplified block diagram of a system environment that may be used in accordance with an embodiment of the present invention.

FIG. 8 is a simplified block diagram of a computer system that may be used in accordance with an embodiment of the present invention.

DETAILED DESCRIPTION

In the following description, for the purposes of explanation, numerous details are set forth in order to provide an understanding of various embodiments of the present invention. It will be apparent, however, to one skilled in the art that certain embodiments can be practiced without some of these details.

Aspects of the present invention include a parameterization approach that provides users with an easy way to write queries and/or views in CEP, which differ in some specific values. For example, the above-mentioned queries can have a single parameterized query that can act as a template and then later can provide the possible values for those bindings, which internally may generate multiple queries and views.

In the following query:

-   -   SELECT symbol, AVG (price) AS average, :1 AS market     -   FROM StockTick [RANGE 5 SECONDS]     -   WHERE symbol=:2

The :1 and :2 act as placeholders. Different values can be bound to these placeholders either at deployment time or at runtime. Furthermore, a config file associated with a processor component that is configured to process such a query may look like the following:

<n1:config xmlns:n1=“http://www.bea.com/ns/wlevs/config/application”  xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”>  <processor>   <name>myProcessor</name>   <rules>    <rule id=“MarketQuery”><![CDATA[     SELECT symbol, AVG(price) AS average, :1 AS market     FROM StockTick [RANGE 5 SECONDS]     WHERE symbol = :2    ]]></rule>   </rules>   <bindings>    <binding id=“MarketQuery”>     <params id=“nasORCLQuery”>NASDAQ, ORCL</params>     <params id=“nyJPMQuery”>NYSE, JPM</params>     <params id=“nyWFCQuery”>NYSE, WFC</params>    </binding>   </bindings>  </processor> </n1:config>

In the above example, the MarketQuery CQL query includes two placeholders: one in the SELECT clause and another in the WHERE clause. In this embodiment, the values for these placeholders are also included in the config file itself (or they may also be provided during runtime). The <binding id=“MarketQuery”> element specifies the list of parameter sets that will be passed to MarketQuery at runtime. Each parameter set is specified with a single <params> element. Because there are two placeholders in the parameterized query, each <params> element specifies two values separated by a comma.

At runtime, after the placeholders are substituted with the corresponding parameter values, the preceding parameterized query effectively breaks down into the following three queries:

-   -   SELECT symbol, AVG(price) AS average, NASDAQ AS market     -   FROM StockTick t RETAIN ALL EVENTS     -   WHERE symbol=ORCL←Query name will be MaketQuery_nasORCLQuery     -   SELECT symbol, AVG(price) AS average, NYSE AS market     -   FROM StockTick t RETAIN ALL EVENTS     -   WHERE symbol=JPM←Query name will be MarketQuery_nyJPMQuery     -   SELECT symbol, AVG(price) AS average, NYSE AS market     -   FROM StockTick t RETAIN ALL EVENTS     -   WHERE symbol=WFC←Query name will be MarketQuery_nyWFCQuery

Further aspects of the present invention include using Java™ MBean API's to manipulate sets of parameters. In one embodiment, the parameterized queries and views can be added either at deployment or runtime from the clients. Further, Java™ Management Extensions (JMX) architecture-based MBean APIs may be provided to access or modify the bindings corresponding to the parameterized query or view. A client can call the MBean APIs in order to do the same. In one embodiment, the following MBean APIs may be provided to support such bindings:

Processor ConfigMBean APIs:

-   -   bindParameters (String preparedStatementId, String paramsId,         String paramsValue)→adds the parameter or binding for query or         view (preparedStatementId is id of the query or view), paramsId         is the identifier of the param or binding, paramsValue is the         comma separated values of the bindings.     -   replaceBoundParameters (String preparedStatementId, String         paramsId, String newParamsValue)→replaces an existing Parameter         for a query or view where preparedStatementId is the id of the         query or view, paramsId is the param name and newParamsValue is         the new comma separated value.     -   replaceAllBoundParameters (String preparedStatementId, String[ ]         paramsIds, String[ ] newParamValues)→replaces multiple         parameters for a query or view. The size of array paramsIds and         newParamValues should be same i.e., they should have a one on         one mapping.     -   unbindParameters (String preparedStatementId, String         paramsId)→deletes or unbinds a specific param or binding of a         query or a view.     -   unbindAllParameters (String preparedStatementId)→deletes or         unbinds all the bindings for a rule.     -   String getBoundParameters (String preparedStatementId, String         paramId)→Gets the parameter value for a particular query or view         and the parameter name.     -   String[ ] getAllBoundParameters (String         preparedStatementId)→Gets all the parameters or bindings values         for a query or a view.     -   int getNumberOfBoundParameters (String preparedStatementId)→Gets         the total count of the parameters bound to a query or view.

Processor RuntimeMBeans APIs:

-   -   Map<String, String> getAllParamRules( )→Returns the Map of all         the parameterized queries and views existing in a processor. Key         is the query or view id and the value is the corresponding         statement.

Accordingly, embodiments of the present invention allow for users to write a single parameterized query or view template that can then be bound to different bindings either at deployment or runtime. The user can provide new bindings, which will internally generate a new query and then run it. This template version of queries and views provides an effective way to add and/or remove queries which differ only by some constants. Furthermore, such parameterization or template style of queries and view provides a very user-friendly way to dynamically modify/add/delete hundreds of queries. It provides a user-friendly way for writing CQL queries, and offers ease of use in creating many rules that are similar and provide easy management for such rules.

Further aspects of the present invention provide techniques for determining a placeholder occurring in a parameterized query for processing an event stream. A parameter for the placeholder may then be determined. This may be provided at deployment (e.g., specified in the config file as shown above) or provided during runtime. A query may then be generated from the parameterized query by substituting the placeholder with the parameter. If there are multiple sets of parameters for the placeholder, then multiple queries may be generated from the single parameterized query. A query generated from the substitution may then be provided to the CQL engine that is configured to generate executable instructions for the query. The executable instructions may then be executed to process the event stream.

Turning now to FIG. 1, a simplified block diagram of a system 100 that may incorporate an embodiment of the present invention is shown. As depicted in FIG. 1, system 100 comprises an event processing server 102 that is configured to process one or more incoming data or event streams 104, 106, and 108. Streams 104, 106, and 108 may be received from different sources including a database, a file, a messaging service, various applications, devices such as various types of sensors (e.g., RFID sensors, temperature sensors, etc.), tickers, and the like. Server 102 may receive the streams via a push-based mechanism or a pull-based mechanism or other mechanisms.

A data or event stream is a real-time sequence of events. Multiple events may be received in a stream. The data stream can thus be considered as a stream of unbounded sets of data. In one embodiment, a data stream is a sequence of <tuple, timestamp> pairs. The tuple refers to the data portion of a stream. A tuple may be considered as similar to a row in a table. The tuples in a stream have a schema. A stream can include multiple tuples. Timestamps define an order over the tuples in a data stream. The timestamps in a data stream may reflect an application's notion of time. For example, the timestamp may be set by an application on the system receiving an event stream. The receiving system may timestamp an event on receipt as configured by the application, for example, if specified in the CREATE STREAM DDL that is used to define a structure of the events stream and the mechanism used to use application time or system time as the timestamp. In other embodiments, the timestamp associated with a tuple may correspond to the time of the application sending the data events. The timestamp is part of the schema of a stream. There could be one or multiple tuples with the same timestamp in a stream. The tuples in a stream can be viewed as a series of events and accordingly the data stream is also referred to as an event stream. An event stream can thus be considered to comprise a series of events, each with an associated timestamp. For example, an event stream may comprise a series of temperature readings from a sensor such as 10°, 15°, 20°, etc. and associated time stamps. For purposes of this application, the terms “tuple” and “event” are being used interchangeably.

System 100 comprises an event processing server 102 that is configured to process event streams. Event processing server 102 may receive one or more event streams. As shown in FIG. 1, event processing server 102 receives streams 104, 106, and 108. Each event stream comprises one or more events. The events in a stream are received by server 102 in a sequence at specific time points. Server 102 is configured to perform various types of processing on the incoming streams. According to an embodiment of the present invention, server 102 is configured to detect patterns in the incoming event streams based upon the events in the event streams received by server 102. In one embodiment, server 102 performs the pattern matching without doing any backtracking processing on the events of the stream being analyzed as the events are received by server 102. Pattern matching may be performed using a type of continuous query that is applied to the incoming streams. Server 102 may also perform other types of processing on the input streams such as running other continuous queries on the incoming event streams, and other operations. An example of an event processing server is the Oracle Complex Event Processor from Oracle™ Corporation. Alternatively, MATCH_RECOGNIZE may also be used to perform pattern matching

In the embodiment depicted in FIG. 1, server 102 comprises a pattern matching module 110 that is configured to perform processing related to pattern matching for one or more event streams. As depicted in FIG. 1, pattern matching module 110 comprises a pattern input interface 112, a class-technique determinator 113, an automaton generator 114, and a matcher 116. Pattern input interface 112 provides an interface for receiving information specifying patterns to be matched in the event streams. Pattern input interface 112 may provide a graphical user interface that allows information to be entered specifying one or more patterns to be matched, a command line interface for specifying the patterns to be matched, or some other interface. A pattern to be matched may be specified by a user of server 102. Information identifying a pattern to be matched may also be received from other sources, for example, from other components or modules of event processing server 102, or other systems or applications.

In one embodiment, patterns to be matched are specified using regular expressions. A regular expression is a string of symbols (also referred to as correlation names or correlation variables) representing the pattern to be matched. The regular expression is built using one or more symbols and may use one or more operators. Examples of operators include but are not limited to a concatenation operator (e.g., an “AND” operator between symbols in a regular expression may be used to indicate an AND relationship between the symbols), alternation operator (e.g., a vertical bar ‘|’ may separate symbols in a regular expression indicating an OR condition for the symbols), one or more quantifiers, grouping operator (e.g., indicated by parentheses), and the like. Examples of quantifiers include an asterisk ‘*’ implying zero or more occurrences of the symbol with which the quantifier is associated, a plus sign ‘+’ implying one or more occurrences of the symbol with which the quantifier is associated, a question mark ‘?’ implying zero or one occurrences of the symbol with which the quantifier is associated, reluctant quantifiers, and the like. Examples of operators and quantifiers that may be used, including associated syntax for the regular expressions, are provided and described in Fred Zemke et al., “Pattern Matching in Sequence of Rows (12),” ISO/IEC JTCi/SC32 WG3:URC-nnn, ANSI NCITS H2-2006-nnn, Jul. 31, 2007, the entire contents of which are herein incorporated by reference for all purposes.

In the past, regular expressions have been mainly used to find patterns in strings. In embodiments of the present invention, the power of regular expressions is used to match patterns in event streams received by event processing server 102. Regular expressions provide a simple, concise, and flexible way for specifying patterns to be matched. In the embodiment depicted in FIG. 1, event processing server 102 may receive pattern information 118 specifying a regular expression to be matched in one or more event streams. In one embodiment, the pattern may be specified using pattern input interface 112 of pattern matching module 110.

Pattern information 118 may be provided using different languages. In one embodiment, a programming language such as SQL, which is commonly used to query databases, may be used. Extensions may be provided to SQL to express the pattern to be matched for event streams. For example, pattern information 118 may specify a SQL query comprising a regular expression specifying a pattern to be matched in one or more event streams received by event processing server 102.

Oracle supports a CQL (Continuous Query Language) language in Complex Events Processing (CEP) products. CQL is very similar to SQL with extensions for stream processing. Pattern matching constructs proposed to extend SQL to specify pattern matching via regular expressions (e.g., the constructs described in Fred Zemke et al., “Pattern Matching in Sequence of Rows (12),” ISO/IEC JTCi/SC32 WG3:URC-nnn, ANSI NCITS H2-2006-nnn, Jul. 31, 2007, the entire contents of which are herein incorporated by reference for all purposes) have been adopted in CQL to extend CQL for the purpose of specifying pattern matching requirements over event streams.

Typically, pattern matching for a query pattern occurs only over a single input stream. Pattern matching may also be performed over multiple event streams, for example, using CQL. In one embodiment, this may be done by first performing a UNION of all the relevant input streams over which pattern matching is to be done with the result defining a view corresponding to an intermediate stream, and the pattern to be matched can be specified over this single intermediate stream. The pattern will then be matched to all the streams included in the view.

Referring next to FIG. 2A, a method 200 of implementing parameterized queries in CEP is illustrated, according to embodiments of the present invention. At process block 205, a query template with one or more bind variables is provided. The sets of parameters corresponding to the bind variables (i.e., to which the bind variables are to be bound) are provided (process block 210). In one embodiment, the sets of parameters may be provided either statically (e.g., via a config file, done typically at time of deployment) or dynamically at runtime (e.g., using JMX or some other mechanism). Accordingly, dynamic provisioning using JMX are used during runtime, and can be used for deleting sets of parameters, providing new sets of parameters, etc.

At process block 215, the query template is parsed to determine positions of bind variables. In one embodiment, the bind variables may be identified, for example, by :1, :2, :3, etc. The ordering of the bind variables within the query does not have to be in the order of the 1, 2, 3, etc. Accordingly, a map of the determined positions of the bind variables may be built (process block 220).

At process block 225, the provided sets of parameters list may be scanned to determine the sets of parameters that are to be bound to the corresponding bind variables, and then the binding may occur (process block 230). At process block 235, the bind variables may be substituted with the sets of parameters.

Moving from point ‘A’ in FIG. 2A to point ‘A’ in FIG. 2B a method 201 of implementing parameterized queries in CEP is illustrated, according to embodiments of the present invention. At decision block 240, a determination is made whether there are multiple sets of parameters for the same set of bind variables. For example:

<rule id=“MarketQuery”><![CDATA[  SELECT symbol, AVG(price) AS average, :1 AS market    FROM StockTick [RANGE 5 SECONDS]    WHERE symbol = :2   ]]></rule>  </rules>  <bindings>   <binding id=“MarketQuery”>    <params id=“nasORCLQuery”>NASDAQ, ORCL</params>    <params id=“nyJPMQuery”>NYSE, JPM</params>    <params id=“nyWFCQuery”>NYSE, WFC</params> Here there are three parameter sets. (each in bold) Here the bind variable set if :1, :2

Furthermore, if it is determined that multiple sets of sets of parameters do not correspond to the same bind variable, then a single new query is generated with the sets of sets of parameters (process block 245). If it is determined that multiple sets of parameters are provided for the same bind variable, then separate new queries are instantiated for each parameter (process block 250).

Accordingly, at process block 255, the instantiated queries are then injected into the CEP server (query sent to the CQL engine). The CQL engine then builds a query execution plan (process block 260) and adds the query to the runtime environment as a continuous query (process block 265). Finally, at process block 270, the instantiated query or queries are executed.

Turning now to FIG. 2C, a method 202 of implementing parameterized queries in CEP is illustrated, according to embodiments of the present invention. At process block 275, a new parameter (instead of an old parameter) may be specified for a bind parameter. In such a situation, queries which have been instantiated with the old parameter are identified (process block 280).

Accordingly, the identified queries using the old parameter are deleted from the runtime environment (process block 285). At process block 290, queries using the new sets of parameters for the runtime system are instantiated. Processing as described above may be done using neighbor sets of parameters. For example, if the bind variables position map has already been created, then there may be no need to repeat the steps up to this—processing can continue where the new sets of parameters are scanned and then the substitution is performed. In essence, the exiting query is replaced with the new instantiated query with the new sets of parameters.

Furthermore, sets of parameters may be tied to a rule that include the query template. In one embodiment, a view definition (done using, for example, CQL) may also use bind variables. Parameterization in the context of continuous queries, “parameterized query” or “query template” includes a query with at least one bind variable.

Turning now to FIG. 3, a method 300 for describing a CQL and business queries life-cycle is illustrated, in accordance with embodiments of the present invention. At block 305 a an IT role is created, which includes projects lists, sets of parameters, and conditions 305 b. Further, at block 305 c, IT user/business users analyst cooperative rules are created.

At block 310, the queries and views are parameterized. For example, natural language +0 . . . 1 parameterized query +0 . . . n parameterized views, and automatic view/query, dependency tracking 310 a may be generated. At block 315, business temples are created for the business analyst role 315 a. At block 315 b, a new query is instantiated via a hyperlink, or the like.

Accordingly, at block 320 business queries are created. Then, the business user role sees query as a single logical operator 320 a, and is able to modify CQL query and views 320 b, to return to the CQL queries and views 305.

FIG. 4A includes an example query 405 which is permanently bound to hard-coded values. FIG. 4B includes a parameterized query 410, bindings 415, and business rules 420, and FIG. 4C includes templates 425, parameterized views 430, and parameterized queries 435. Furthermore, FIG. 4D includes parameterized view and query 440, a template 445, and a business query 450.

One Example which Uses the Information in FIGS. 4A-4D is as Follows:

-   -   Filter1: (eventName=E1, path=P1, statName=countValue)     -   Fact1: (countValue of input events having eventName=E1, path=P1)     -   Condition1: Fact1<1000     -   Trigger1: Condition1 happening 2 or more times in the last 30         minutes

Another Example is as Follows:

-   -   Filter1: (eventName=E1, path like ‘*P1*’, statName=count)     -   Fact1: (countValue of input events having eventName=E1 and paths         like ‘*P1*’)     -   Condition1: Fact1<1000     -   Trigger1: Condition1 happening 2 or more times in the last 30         minutes on each distinct path.

Accordingly, these queries return the sum of the specified statistic and time at which the sum of the specified statistic is less than 1000, 2 or more times in 30 minutes, for event name E1, path P1, and statistic countValue.

Turning now to FIG. 5A, a system 500 for implementing parameterized queries in CEP is illustrated, according to an embodiment of the present invention. In one embodiment, system 500 may include a CEP server 505 which includes a CQL engine 510 and a config file 520. Further, the CEP server 505 is in communication with a visualizer 525.

In one embodiment, the CQL engine 510 executes all of the queries together. The execution plan for a CQL engine 510 includes a set of nodes connected together—all the queries are part of the execution plan and are thus not independent. Thus, CEP string substitution is used to replace the bind variables with the sets of parameters provided for the bind variables, without doing any kind of type checking, etc. This is different from regular databases, where bind variables also have to pass through type checking, etc. As a result, bind variables in the CEP context offer a more flexible and as a result a more powerful solution, and allow the user to insert arbitrary predicates. Accordingly, bind variables in the CEP environment may be typeless.

CQL engine 510 is configured to implement multiple CEP applications 515 a, 515 b, to 515 n. For example, multiple CEP applications can be written, each doing different processing, and they can all be deployed on the same CEP server 505. The CEP server 505 then includes the CQL engine 510 and can have multiple deployed CEP applications (515 a, 515 b, to 515 n).

The visualizer 525 is an interface through which a business user can provide the sets of parameters. Furthermore, the config file 520 is associated with a processor within an application. The config file 520 can be created anytime, at deployment, prior to deployment, or after deployment. Then, when the CEP application (515 a, 515 b, or 515 n) is in the runtime environment, it may have an associated config file 520 that identifies the query template (i.e., the query with the bind variables) and the sets of parameters to be substituted for the bind variables.

FIG. 5B illustrates one embodiment of a config file 520. The config file 520 may include identification of the application with which the file is associated 520 a, identification of the processor 520 b, identification of rules 520 c, the query template 520 d, identification of the sets of parameters 520 e, and the bindings 520 f. Other embodiments of the config file may be used.

Referring next to FIG. 6, an embodiment 600 of a user interface for parameterized queries in CEP is shown. Benefits of such a user interface include helping to remedy the need to provide simplicity of usage. Most business users do not want to write queries. For example, CQL is difficult for non-programmers to understand, so in the CEP case, the query will be designed by someone in the IT dept after understanding the business user's needs, and the query may comprise bind variables. The query is then exposed to the business user in a simple-to-read format (e.g., in an English version of the query that is easy for the business user to understand). The English version may comprise bind sets of parameters (which may be shown via URL links) that bind to actual values at runtime. At runtime, a new query is instantiated with the parameter values provided to be substituted for the bind variables, and the instantiated query is then injected into the CEP system for execution. This offers ease of use to the user. The business users do not have to be concerned with low level CQL.

FIG. 7 is a simplified block diagram illustrating components of a system environment 700 that may be used in accordance with an embodiment of the present invention. As shown, system environment 700 includes one or more client computing devices 702, 704, 706, 708, which are configured to operate a client application such as a web browser, proprietary client (e.g., Oracle Forms), or the like. In various embodiments, client computing devices 702, 704, 706, and 708 may interact with an event processing system 712.

Client computing devices 702, 704, 706, 708 may be general purpose personal computers (including, by way of example, personal computers and/or laptop computers running various versions of Microsoft Windows and/or Apple Macintosh operating systems), cell phones or PDAs (running software such as Microsoft Windows Mobile and being Internet, e-mail, SMS, Blackberry, or other communication protocol enabled), and/or workstation computers running any of a variety of commercially-available UNIX or UNIX-like operating systems (including without limitation the variety of GNU/Linux operating systems). Alternatively, client computing devices 702, 704, 706, and 708 may be any other electronic device, such as a thin-client computer, Internet-enabled gaming system, and/or personal messaging device, capable of communicating over a network (e.g., network 710 described below). Although exemplary system environment 700 is shown with four client computing devices, any number of client computing devices may be supported. Other devices such as devices with sensors, etc. may interact with system 712.

System environment 700 may include a network 710. Network 710 may be any type of network familiar to those skilled in the art that can support data communications using any of a variety of commercially-available protocols, including without limitation TCP/IP, SNA, IPX, AppleTalk, and the like. Merely by way of example, network 710 can be a local area network (LAN), such as an Ethernet network, a Token-Ring network and/or the like; a wide-area network; a virtual network, including without limitation a virtual private network (VPN); the Internet; an intranet; an extranet; a public switched telephone network (PSTN); an infra-red network; a wireless network (e.g., a network operating under any of the IEEE 802.11 suite of protocols, the Bluetooth protocol known in the art, and/or any other wireless protocol); and/or any combination of these and/or other networks.

System 712 may comprise one or more server computers which may be general purpose computers, specialized server computers (including, by way of example, PC servers, UNIX servers, mid-range servers, mainframe computers, rack-mounted servers, etc.), server farms, server clusters, or any other appropriate arrangement and/or combination. In various embodiments, system 712 may be adapted to run one or more services or software applications described in this application.

System 712 may run an operating system including any of those discussed above, as well as any commercially available server operating system. System 712 may also run any of a variety of additional server applications and/or mid-tier applications, including HTTP servers, FTP servers, CGI servers, Java servers, database servers, and the like. Exemplary database servers include without limitation those commercially available from Oracle, Microsoft, Sybase, IBM and the like.

System environment 700 may also include one or more databases 714 and 716. Databases 714 and 716 may reside in a variety of locations. By way of example, one or more of databases 714 and 716 may reside on a storage medium local to (and/or resident in) system 712. Alternatively, databases 714 and 716 may be remote from system 712, and in communication with system 712 via a network-based or dedicated connection. In one set of embodiments, databases 714 and 716 may reside in a storage-area network (SAN) familiar to those skilled in the art. Similarly, any necessary files for performing the functions attributed to system 712 may be stored locally on system 712 and/or remotely, as appropriate. In one set of embodiments, databases 714 and 716 may include relational databases, such as Oracle 10g and 11g, which are adapted to store, update, and retrieve data in response to SQL-formatted commands.

FIG. 8 is a simplified block diagram of a computer system 800 that may be used in accordance with embodiments of the present invention. For example, system 800 may be used to implement event processing server 102 in FIG. 1. Computer system 800 is shown comprising hardware elements that may be electrically coupled via a bus 824. The hardware elements may include one or more central processing units (CPUs) 802, one or more input devices 804 (e.g., a mouse, a keyboard, etc.), and one or more output devices 806 (e.g., a display device, a printer, etc.). Computer system 800 may also include one or more storage devices 808. By way of example, the storage device(s) 808 may include devices such as disk drives, optical storage devices, and solid-state storage devices such as a random access memory (RAM) and/or a read-only memory (ROM), which can be programmable, flash-updateable and/or the like.

Computer system 800 may additionally include a computer-readable storage media reader 812, a communications subsystem 814 (e.g., a modem, a network card (wireless or wired), an infra-red communication device, etc.), and working memory 818, which may include RAM and ROM devices as described above. In some embodiments, computer system 800 may also include a processing acceleration unit 816, which can include a digital signal processor (DSP), a special-purpose processor, and/or the like.

Computer-readable storage media reader 812 can further be connected to a computer-readable storage medium 810, together (and, optionally, in combination with storage device(s) 808) comprehensively representing remote, local, fixed, and/or removable storage devices plus storage media for temporarily and/or more permanently containing computer-readable information. Communications subsystem 814 may permit data to be exchanged with network 710 and/or any other computer described above with respect to system environment 700.

Computer system 800 may also comprise software elements, shown as being currently located within working memory 818, including an operating system 820 and/or other code 822, such as an application program (which may be a client application, Web browser, mid-tier application, RDBMS, etc.). In an exemplary embodiment, working memory 818 may include executable code and associated data structures (such as caches) used for processing events and performing data cartridge-related processing as described above. It should be appreciated that alternative embodiments of computer system 800 may have numerous variations from that described above. For example, customized hardware might also be used and/or particular elements might be implemented in hardware, software (including portable software, such as applets), or both. Further, connection to other computing devices such as network input/output devices may be employed.

Storage media and computer readable media for containing code, or portions of code, can include any appropriate media known or used in the art, including storage media and communication media, such as but not limited to volatile and non-volatile, removable and non-removable media implemented in any method or technology for storage and/or transmission of information such as computer readable instructions, data structures, program modules, or other data, including RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store or transmit the desired information and which can be accessed by a computer.

Although specific embodiments of the invention have been described, various modifications, alterations, alternative constructions, and equivalents are also encompassed within the scope of the invention. Embodiments of the present invention are not restricted to operation within certain specific data processing environments, but are free to operate within a plurality of data processing environments. Additionally, although embodiments of the present invention have been described using a particular series of transactions and steps, it should be apparent to those skilled in the art that the scope of the present invention is not limited to the described series of transactions and steps.

Further, while embodiments of the present invention have been described using a particular combination of hardware and software, it should be recognized that other combinations of hardware and software are also within the scope of the present invention. Embodiments of the present invention may be implemented only in hardware, or only in software, or using combinations thereof.

The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense. It will, however, be evident that additions, subtractions, deletions, and other modifications and changes may be made thereunto without departing from the broader spirit and scope as set forth in the claims. 

What is claimed is:
 1. A method of providing parameterized queries in complex event processing (CEP), the method comprising: providing a query template which includes one or more bind variables; providing sets of parameters corresponding to the one or more bind variables; parsing the query template to determine positions of the one or more bind variables; scanning the provided sets of parameters to determine which of the sets of parameters are to be bound to the one or more bind variables; binding the one or more bind variables which are determined to be bound to the sets of parameters; and substituting the bound one or more bind variables with the corresponding sets of parameters.
 2. The method of providing parameterized queries in CEP as in claim 1, further comprising building a map of the determined positions of the one or more bind variables.
 3. The method of providing parameterized queries in CEP as in claim 2, wherein the substituting of the one or more bind variables with the corresponding sets of parameters further comprises using the map of determined positions of the one or more bind variables to place the bound sets of parameters within the query template.
 4. The method of providing parameterized queries in CEP as in claim 1, wherein the providing of the sets of parameters corresponding to the one or more bind variables is performed either statically or dynamically.
 5. The method of providing parameterized queries in CEP as in claim 4, wherein the providing of the sets of parameters corresponding to the one or more bind variables is performed statically by using a config file at deployment time of the query template.
 6. The method of providing parameterized queries in CEP as in claim 4, wherein the providing of the sets of parameters corresponding to the one or more bind variables is performed dynamically by using a module management solution.
 7. The method of providing parameterized queries in CEP as in claim 5, wherein the config file includes one or more of the following: application association, processor association, query rules, the query template, the sets of parameters, or the bindings.
 8. The method of providing parameterized queries in CEP as in claim 1, further comprising instantiating a new query based on the query temple which includes the sets of parameters substituted for the one or more bind variables.
 9. The method of providing parameterized queries in CEP as in claim 8, further comprising: instantiating the new query; and injecting the new query into a CEP server.
 10. The method of providing parameterized queries in CEP as in claim 9, further comprising: based on the new query, building a query execution plan; adding the query execution plan to a runtime environment as a continuous query; and executing the continuous query.
 11. The method of providing parameterized queries in CEP as in claim 1, further comprising: determining that multiple sets of parameters correspond to the same bind variable; and instantiating a separate new query for each of the multiple sets of parameters which correspond to the same bind variable.
 12. A system for providing parameterized queries in complex event processing (CEP), the system comprising: a memory; and a processor coupled with the memory, wherein the memory has sets of instructions stored thereon which, when executed by the processor, cause the processor to: determine a placeholder occurring in a parameterized query for processing an event stream; determine a parameter for the placeholder; and generate a query from the parameterized query by substituting the placeholder with the parameter.
 13. The system for providing parameterized queries in CEP as in claim 12, wherein the sets of instructions when further executed by the processor, cause the processor to: generate the query; and process the event stream.
 14. The system for providing parameterized queries in CEP as in claim 13, further comprising: a CEP server including a CQL engine, wherein the CQL engine instantiates a plurality of CEP applications; and a visualizer in communication with the CEP server, wherein the visualizer is configured to display result information from the processed event stream.
 15. A computer-readable medium having sets of instructions stored thereon which, when executed by a computer, cause the computer to: provide a query template which includes one or more bind variables; provide sets of parameters corresponding to the one or more bind variables; parse the query template to determine positions of the one or more bind variables; scan the provided sets of parameters to determine which of the sets of parameters are to be bound to the one or more bind variables; bind the one or more bind variables which are determined to be bound to the sets of parameters; and substitute the bound one or more bind variables with the corresponding sets of parameters.
 16. The computer-readable medium of claim 15, wherein the sets of instructions when further executed by the computer, cause the computer to determine that new sets of parameters are specified for binding.
 17. The computer-readable medium of claim 16, wherein the sets of instructions when further executed by the computer, cause the computer to: identify queries which have been instantiated using sets of parameters prior to being specified with new sets of parameters; and delete the queries which have been instantiated using sets of parameters prior to being specified with new sets of parameters.
 18. The computer-readable medium of claim 17, wherein the sets of instructions when further executed by the computer, cause the computer to instantiate queries using the new sets of parameters for the runtime system.
 19. The computer-readable medium of claim 15, wherein the sets of instructions when further executed by the computer, cause the computer to: convert the sets of parameters into strings; check the strings of the sets of parameters to determine a form of the sets of parameters; compare the determined type of the sets of parameters with the type of the corresponding bind variables; and in response to the determined type of the sets of parameters matching the type of the corresponding bind variables, verify the sets of parameters.
 20. The computer-readable medium of claim 19, wherein the type of the corresponding bind variables and sets of parameters includes one or more of the following: INT, FLOAT, LONG, BIGDECIMAL, DOUBLE, and STRING. 